﻿Imports System
Imports System.IO
Imports System.Data.OleDb
Imports System.Data
Imports System.Drawing
Imports System.Drawing.Imaging
Namespace Arwani
    Partial Class Backend_AddEditRaffleListMaster
        Inherits System.Web.UI.Page

        Protected Sub Page_Load(ByVal sender As Object, ByVal e As System.EventArgs) Handles Me.Load
            If (Session("ADMIN_USER") IsNot Nothing) Then
                If Page.IsPostBack Then Exit Sub
                
            Else
                Response.Redirect("Default.aspx")
            End If

        End Sub

        Protected Sub btnSubmit_Click(ByVal sender As Object, ByVal e As System.EventArgs) Handles btnSubmit.Click
            Dim strQ As String
            Dim strQckh As String
            Dim arwCon As New ArwaniController

            If ChkActive.Checked Then
                strQckh = "update RaffleMaster set Active=0"
                arwCon.ExecuteNonQuery(strQckh)
            End If
            strQ = "INSERT INTO RaffleMaster (Name,StartDate,EndDate,Description,Active) VALUES ('" & txtName.Text & "','" & calStartDate.SelectedDate & "','" & calEndDate.SelectedDate & "', '" & txtDesc.Text & "','" & ChkActive.Checked & "')"
            arwCon.ExecuteNonQuery(strQ)
            Response.Redirect("RaffleListMaster.aspx")


        End Sub


     

        Protected Sub btnCancel_Click(ByVal sender As Object, ByVal e As System.EventArgs) Handles btnCancel.Click
            Response.Redirect("RaffleListMaster.aspx")
        End Sub

        Protected Sub calStartDate_SelectionChanged(sender As Object, e As System.EventArgs) Handles calStartDate.SelectionChanged
            TextBox1.Text = calStartDate.SelectedDate
        End Sub

        Protected Sub calEndDate_SelectionChanged(sender As Object, e As System.EventArgs) Handles calEndDate.SelectionChanged
            TextBox2.Text = calEndDate.SelectedDate
        End Sub
    End Class
End Namespace